import React, { useState } from 'react'
import Test from './Test'
export default function App() {
  console.log('app执行了')
  // 组件中有几个状态数据,useState就调用几次
  const [count, setCount] = useState(0)
  const [msg, setMsg] = useState('hello hook')
  // const [数据, 修改数据的方法] = useState(初始值)
  // console.log(count, setCount)
  return (
    <div>
      App
      <p>{count}</p>
      <p>{msg}</p>
      <button
        onClick={() => {
          // setCount(目标值)
          setCount(2) //异步的
          // console.log(count)
        }}
      >
        +
      </button>
      <hr />
      <Test></Test>
    </div>
  )
}
